// MyException.h: interface for the CMyException class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MYEXCEPTION_H__DC7EE444_7A09_11D2_8064_00A0C91F41A7__INCLUDED_)
#define AFX_MYEXCEPTION_H__DC7EE444_7A09_11D2_8064_00A0C91F41A7__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

enum severity {noerror,severe,normal};
enum the_exceptions 
    {
        none,
        illegal_instruction,
        illegal_directive,
        illegal_register,
        illegal_register_pair,
        illegal_bin_number,
        illegal_octal_number,
        illegal_hex_number,
        illegal_rst,
        bad_system_call,
        ret_executed,

        duplicate_symbol,
        unresolved_symbol,
        syntax_error,
        number_expected,
        register_expected,
        number_or_identifier_expected,
        comma_expected,
        instruction_not_implemented,

        empty_file_name,
        file_open_error,
        table_overflow,
        unknown,
        syntax,

		illegal_led_display_request,

        breakpoint,
        hlt_executed,

        // exceptions generated by Com port communication
        comport_open,
		comport_read,
		comport_write,
        // exceptions generated by CPrinter class
        temporary_file_open,

        // exceptions from CDebugData
        no_source_equivalent,
        no_address_equivalent,
};

class CMyException 
{
    //Attributes
public:

public:
	void ShowErrorMessage();
	BOOL IsRetExecuted();
	BOOL IsBreakPoint();
	int GetColumn();
	int GetLineNumber();
	int ExtractNumber(char *str,int nBase);
	void FindLineAndColumn();
	void Init();
	CString & GetErrorMessage();
	void SetErrorMessage(CString );
	void SetSeverity(severity s);
    void SetException(the_exceptions e);
    void Set(severity s, the_exceptions e);
    void Set(severity s, the_exceptions e,CString);

    inline severity GetSeverity() { return m_severity; }
    inline the_exceptions GetException() { return m_exception; }
    int DidExceptionOccur() { return m_nExceptionOccured; }
	
    CMyException();
    CMyException(severity,the_exceptions,CString str);
    //CMyException(severity,the_exceptions,CString str, int num);
	virtual ~CMyException();

protected:
    int m_nLine,m_nColumn;
    CString m_szErrorMsg;
    the_exceptions m_exception;
    severity m_severity;
    int m_nExceptionOccured;

};

#endif // !defined(AFX_MYEXCEPTION_H__DC7EE444_7A09_11D2_8064_00A0C91F41A7__INCLUDED_)
